#ifndef _SERVICES_LICENSE_H_
#define _SERVICES_LICENSE_H_

#ifdef	__cplusplus

#include <utilex/calldll.hpp>
#include <core/license.h>
	
class CLicenseLoader : protected IImpModuleBase
{
public:
	pfnGetGetLicenseCode func;

	inline CLicenseLoader()
	{

	}
	virtual STFunDesc *GetFunDefs()
	{
		static STFunDesc s_FunDefs[] =
		{
			{ (char *)"GetLicenseCode",0},
			{ (char *)"null",1}
		};
		return s_FunDefs;
	}
	virtual bool SetFuncAddress(size_t i, void *p)
	{
		switch (i)
		{
		case 0:
			this->func = (pfnGetGetLicenseCode)(p);
			break;
		}
		return true;
	}
	virtual ~CLicenseLoader()
	{
	
	}

	HRESULT LoadLicnese(const TCHAR* pModPathName)
	{
		tmemset(m_szModuleName, 0, MAX_PATH);
		tstring_strcpy(m_szModuleName, MAX_PATH, pModPathName);

		int nRet = Load();
		if (nRet == -1)
		{
			debug_view("CComLoader->Load fuc fail")
			wdebug_view(m_szModuleName);
			tmemset(m_szModuleName, 0, MAX_PATH);
			return E_FAIL;
		}

		if (func == NULL) {
			debug_view("CComLoader->DllGetClassObject error")
			return E_FAIL;
		}

		return S_OK;
	}
};


#endif


#endif 










